import Immutable from 'seamless-immutable';
import * as types from '../constants/ActionTypes';

const officialPackage = Immutable.from({
  packageData: {},
});
export default function officialPackageReducer(state = officialPackage, action) {
  const { payload, type } = action;
  switch (type) {
    case types.FETCH_OFFICIAL_PACKAGE:
      return state.setIn(['packageData'], payload);
    case types.RESTORE_PACKAGE:
      return state.setIn(['packageData'], {});
    default:
      return state;
  }
}
